package com.atguigu.gmall.order.client;

import com.atguigu.gmall.common.result.Result;
import com.atguigu.gmall.model.order.OrderInfo;
import com.atguigu.gmall.order.client.impl.OrderDegradeFeignClient;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;

import javax.servlet.http.HttpServletRequest;

@FeignClient(value = "service-order",fallback = OrderDegradeFeignClient.class)
public interface OrderFeignClient {

    /**
     * 订单结算页数据.
     * Feign 远程调用的时候不携带请求头信息. request.getHeader("userId")
     * @param request  String userId = AuthContextHolder.getUserId(request);
     * @return
     */
    //    @GetMapping("api/order/auth/trade")
    //    Result trade(HttpServletRequest request);

    /**
     * 获取订单结算页数据.
     * @return
     */
    @GetMapping("api/order/auth/trade")
    Result trade();


    /**
     * 根据订单Id 获取到订单对象
     * @param orderId
     * @return
     */
    @GetMapping("/api/order/inner/getOrderInfo/{orderId}")
    OrderInfo getOrderInfo(@PathVariable Long orderId);

}
